import request from "@/utils/request";
import type { TradeMarkResponseData, TradeMark } from './type'
//品牌管理模块接口地址
enum API {
    //获取已有品牌接口
    TRADEMARK_URL = "/admin/product/baseTrademark/",
    //添加品牌
    ADDTRADEMARK_URL = '/admin/product/baseTrademark/save',
    //修改已有品牌
    UPDATETRADEMARK_URL = '/admin/product/baseTrademark/update',
    //删除已有品牌
    DELETE_URL = '/admin/product/baseTrademark/remove/'
}
// 品牌管理的接口

export function trademarkList(page: any, limit: any) {
    return request<any, TradeMarkResponseData>({
        url: API.TRADEMARK_URL + `${page}/${limit}`,
        method: 'get',
    })
}

// 添加商品的接口以及修改商品的额接口
export function reqAddOrUpdateTrademark(data: TradeMark) {
    if (data.id) {
        return request<any, any>({
            url: API.UPDATETRADEMARK_URL,
            method: 'put',
            data,
        })
    } else {
        return request<any, any>({
            url: API.ADDTRADEMARK_URL,
            method: 'post',
            data,
        })
    }

}
// 删除商品的接口
export function removeTrademark(id: Number) {
    return request<any, any>({
        url: API.DELETE_URL + id,
        method: 'delete'
    })
}
